package com.dsiab.manageService.common;

import lombok.Data;

import java.util.List;

@Data
public class ResponseMap  {
  // http 状态码
  private int code;
  // 返回信息
  private String msg;
  // 返回的数据
  private Object data;

  public ResponseMap() {
  }

  public ResponseMap(int code, String msg, Object data) {
    this.code = code;
    this.msg = msg;
    this.data = data;
  }
  public ResponseMap(int code, String msg) {
    this.code = code;
    this.msg = msg;
  }
  public static ResponseMap success(Object data) {
    return new ResponseMap(0,"操作成功", data);
  }
  public static ResponseMap success(List data) {
    return new ResponseMap(0,"查询成功", data);
  }
  public static ResponseMap success() {
    return new ResponseMap(0,"操作成功");
  }
  public static ResponseMap error(Object data) {
    return new ResponseMap(1,"操作失败", data);
  }
}
